dataComet allows you to record macros to perform functions such as moving the cursor, making a selection, or appending the selection to a file. Dialogs in the Macro menu allow you to paste in or enter a sequence of macro commands; macros can also be entered and executed in the .edit window. Pressing the "Shift-Enter" key while an edit window is the frontmost window causes the current line or selection to be executed as a macro (pressing the Enter key alone sends the selection as plain text).
You can execute the examples below in the frontmost emulator session by selecting them and pressing "Shift-Enter"...
There are many other ways in which you can trigger dataComet macros:
* With key-combinations you enter on the keyboard (such as
Control Option A, set using "Define key macros");
* With a mouse single- or double-click (set using "Set
single-click macro");
* You can also define a macro to execute when a connection
with a host is complete ("Set Connection macro...") or when
the user closes the connection ("Set Close macro...");
* You can define macros as menu items in the "Macro" menu.
* Option-clicking on button controls brings up a dialog which
allows you to rename the control and set it to execute
a macro when clicked.
The Key Macro on/off switch is in the Macro menu; when macros are on, an M appears in a box on the top left hand side of the screen. When a key macro is currently executing, the M appears in reverse video; the reverse M also appears if keystrokes are pending execution in the key queue. If you wish to cancel the execution of a macro or pending keystrokes, use Command-'.'.
When the dialog for entering key macros comes up, you have three options: select a key by pressing it, select a macro button or menu by option-clicking on it, or show a list of macros currently associated with keys and buttons.
"Press the key-combination you want to remap...": When this prompt appears, you can press a key-combination (or option-click on a button or menu macro); the dialog will show you the name of the key, and will allow you to enter actions (text and commands) you want the key-combination to produce. If there is a key macro associated with that key, the Delete key will be turned on, and the actions associated with the key will be displayed. Note that holding down the mouse button when you press the key-combination will identify the key as an "Alt-key," and such a macro will only be matched if the "ALT" state is set using the "!CA" command documented below (this allows you to switch keyboard configurations with a keystroke, and is used with library keymapping--see the "ALA" dataComet configuration document for an example of extensive key remapping). When the "ALT" state is on, the boxed "M" which shows that key macros are on changes to an "m".
Note that as a convenience the buttons in the dialog will be executed by the emulator if no key macro or other macro has been selected, so you can use it also as a function key pad.
There are several check boxes in the dialog:
"Global": This check box shows whether a key macro is a global macro which can be used by all sessions (saved in the "Comet Default" document). Setting it on allows you to set a key macro as a global macro.
"Ignore Caps Lock": Ignore the caps lock key when matching key macros.
"Use Command Font": Use the "Comet Chicago" font, which displays common macro commands as buttons. If this option is off, the frontmost window's font is used. If you want to enter international characters, this option needs to be off.
You can modify the macro text by entering new text or using copy and paste with the Command-C and Command-V keys. Command-. cancels your modifications to the key macro. When you are finished, you must press the Set button if you want the changes to take effect. The program will then alert you if your entry has errors in the length of the codes. (PLEASE NOTE that the codes are not checked for validity until you execute a key macro by typing the key when you have quit the dialog and Key Macros are set on! Alerts will then inform you of any errors.) If there is no error, the macros are updated immediately; there is no need to save the configuration to save the key macros in the document. If you decide not to change the text, you should press the Cancel button. You can then quit if you wish, or add, remove, or modify other keys.
Text which you enter in the key macro window can be interpreted as either plain text or commands. Individual characters stand for themselves--except for '!' & '\', which can be entered by using '!!' and '\\'. These two characters are special: '!' is used to introduce a command; '\' is used to enter a number, specified using three decimal digits, such as "\010". This numeric entry can be used either in place of a character, or to enter a decimal numeric value.
ASCII control characters can be entered by pressing the option key and the character ('a' through 'z', Space, '[', ']', '\', '@', '^', '_', or '?').
Ordinary text can be entered directly in the text-editing field of the dialog. Commands are entered as a '!' (exclamation point) followed by a pair of characters; the first character selects a class of action, and the second the particular type of this action. In IBM mode, the macro dialogs present buttons to perform input of all the IBM function keys. (PLEASE NOTE that dataComet does not automatically map the Return key to produce an "Enter," so you need to press the "Enter" button to send an Enter command to the host using a macro.) The action classes and associated characters available in both ASCII and the "IBM Keymapping" modes are as follows:
Search forward or backward for a string: ('!/>' or '!/<'), followed by a string terminated with another macro or null ASCII character.
!>\006!/>make!D\001
To make a selection: you must use four commands to set a selection range, each of which uses a number to specify the position on the screen numbered from 0; when all four codes have been received, the selection will be made. (Note also the "!Ea" macro above which selects the current screen only, and "!EA" which selects the screen and the entire scrollback buffer.)
!S\000 selection start Y position, followed by the position
number;
!T\000 selection start X position, followed by the position
number;
!U\023 selection end Y position, followed by the position
number;
!V\080 selection end X position, followed by the position
number.
!S\000!T\000!U\002!V\080
Shift selection left: (<) followed by the number of spaces to shift the selection.
!<\005
Shift selection right: (>) followed by the number of spaces to shift the selection.
!>\080
Set selection length: (#) followed by the new length.
Perform an emulator action: (C) followed by a code:
!CA Set the ALT (mousedown state) modifier bit for all
keypresses. This allows you to have an Alternate macro
set.
!Ca Set ALT off.
!CB Hide the Desktop from the user (for kiosk security).
!CC Close the session without a dialog.
!CE Show the .edit window.
!Ce Show the terminal emulator window.
!CD Show MacTCP smoothed round-trip time and time-out
in the upper right corner of the screen.
!Cd Show MacTCP packets sent and received in the upper
right corner of the screen. This is the default.
The send counter becomes inverted when a resend
is performed.
!CF Close the copyright/help textwindow.
!CH Don't update the display.
!CS Update the display as usual.
!Cs Display cursor position in the emulator window status bar.
!CI Draw each character promptly as it is processed (ASCII only).
!Ci Wait to update screen: draw characters en masse.
!CM Set the top bit (meta-bit) of the next ASCII character.
!Cp Set an IBM PF key to page when pasting text (default is Enter).
!CR Restore line 25.
!CT Turn on cursor positioning using the mouse.
!Ct Turn off cursor positioning.
!CV Turn on VT100 auto-print (i.e., print line on CR, LF, FF).
!Cv Turn off VT100 auto-print.
!CZ Toggle fast drawing mode (useful for library data entry
checking).
!C>string\000
send a string, usually a VT100 parameter, directly to the
emulator.
Display Literal mode
!CL Display all characters sent and received as literals in the
.edit window. In IBM mode, the streams are presented
in an intelligible format; ASCII mode is presented raw.
This mode is very useful for debugging or analyzing host
application output to the emulator.
!Cl Display Telnet layer transmissions also.
Selecting National Character Sets
For VT100 emulators you can select a National Character Set which is mapped into ISO-Latin-1, or the Macintosh character set if a "Control Translation" menu mapping is selected (for this mapping to work correctly, you must select a Macintosh font such as Monaco).
The '!N\000' and '!n\000' macros set the G0 and G1 fonts, respectively. The character sets are selected using a numeric argument:
Macros from !\000 to !\031 correspond to the menu items from left to right, with the items numbered from 1 (i.e., "!\<3-digit menunum>\<3-digit itemnum>"). Adding 64 to the item number sets the shift key to the menu execution; adding 128 to the item number sets the capslock key the menu execution; adding 192 to the item number disables it. (Macro recording provides an easy way to get an item's macro equivalent, since menu items selected are included in the macro.) Menu number 31 corresponds to the Finder menu at the far right (these items can only be disabled, not executed).
!\001\001 Execute the "File New" menu item to open a new session.
!\001\065 Execute the "File New" menu item to open a new text document.
!\001\129 Disable the "File New" menu item.
!\031\192 Disable the Finder menu.
!\031\193 Disable the "Hide Comet" Finder menu item.
Record user input as macro commands: (R) followed by a code:
!RB begin recording;
!RE end recording and place the recording in the scrap for
pasting into the .edit window or key macro dialog.
Delay: (D) followed by the number of seconds to wait specified as \nnn, e.g. "!D\001".
Delay Ticks: (d) followed by the number of ticks (1/60 seconds) to wait specified as \nnn, e.g. "!d\001".
Loop: (L) followed by the number of times to repeat the sequence of macro commands which follows; this sequence must be terminated by an entry containing "!L\000" (loop zero). Using '\255' for the count will cause the loop to continue until the Command-. "cancel" key is pressed.
!L\001echo hello !L\000
Loop break: (l) followed by a level, \001 or \002.
!l\001 break out of a match case.
!l\002 break out of a match case and any enclosing Loop.
Query the user to enter a string: (Q) followed by P, followed by the prompt, followed by a "!Q". macro command to terminate the prompt string. The user's response will be sent out to the host. To enter a password, use "!QS" to replace the characters with dots. Both the query and the response must be under 256 characters.
!QPEnter ID:!QQ
Inform the user using the prompt line or an alert: (q) followed by 'a' if you wish an alert, or 'b' if you want to sound the bell; otherwise the prompt line in the button bar is set.
!qaThis is an alert!!!qa
or
!qb!qzThis is a 25th line prompt!!!qz
or, finally
!qz!qz
will clear the prompt line.
Match String: Delay session macro processing until host output matches string: (Z) followed by a number indicating the number of seconds to wait before aborting; if the number is '\255', it waits forever if the string is not matched. This entry is followed by a list of characters to match, terminated by any non-character macro command (usually a Delay entry). You might use this in a login as follows...
Match case: Execute a macro when host output matches a string: (z) followed by a number indicating the number of seconds to wait before aborting (if the number is '\255', it continues waiting until a "!l\001" breaks out of the match case loop or a "!l\002" breaks out of a repeat loop containing the match case macro; Note: match case macros cannot contain a loop), AND THEN followed by a string terminated by a macro, ANOTHER !z\000 (the numeric argument is ignored for following cases), string, macro, ..., TERMINATED by a !Z\000. Processing of macro commands on the macro queue and new keystrokes is delayed until the match is found.
Triggers: If you use "!Z\001", the match case macro is interpreted as a trigger, and the processing of macro commands and new keystrokes continues while the match case waits for matches and handles them.
Here's an example of a match case macro with paused input:
cat shoplist
!z\030dog!D\000food
!z\255cat!D\000litter
!z\255frog!D\000flies
!l\001!Z\000
produces
litter
food
litter
litter
food
flies
when shoplist is a file containing
dogcatcatdogfrogcatdog
Note that the "cat" in "cat shoplist" is also matched!